home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Education et Sciences / Mathématiques / Matt's_Fract 1.05 / Sources / includes / myErrors.c < prev    next >
C/C++ Source or Header  |  1995-08-13  |  1KB  |  51 lines

  1. #include "AllTools.h"
  2.  
  3. static char *errorStrings[] = {
  4.                 "\p<no error>",
  5.                 "\pThe Menu resource I require is not in the Resource Fork",
  6.                 "\pgestalt not available",
  7.                 "\pthere are no session spaces available",
  8.                 "\pI cant find a dialog I need",
  9.                 "\pNot enough memory for operation",
  10.                 "\pNot enough memory to continue, Please allocate more memory to Application",
  11.                 "\pFile error",
  12.                 "\pDisk is locked",
  13.                 "\pFile is locked",
  14.                 "\pCant evaluate recursive functions",
  15.                 "\pControl does not exist",
  16.                 "\pFunction Error"
  17.                 "\pCannot find window resource",
  18.                 "\pSheet does not exist",
  19.                 "\pThat cell is out of range",
  20.                 "\pInvalid row or column",
  21.                 "\pYou need an 8bit capable computer to run this Application",
  22.                 "\pError in creating control"
  23.                 };
  24.  
  25. void DoError(short theCode, Boolean Exit)
  26. {
  27. DialogPtr    theDialog;
  28. Boolean     itsDone;
  29. short        itemHit;
  30.  
  31. FlushEvents(everyEvent, REMOVE_ALL_EVENTS);
  32. SysBeep(1);
  33. if (Exit == TRUE)    theDialog = GetNewDialog(fatalErrorDialog, nil, (WindowPtr)-1);
  34. if (Exit == FALSE)    theDialog = GetNewDialog(badErrorDialog  , nil, (WindowPtr)-1);
  35. if (theDialog == 0) ExitToShell();
  36.  
  37. SetTheInfoStr(theDialog, ierrorText, errorStrings[theCode]);
  38.  
  39. itsDone = FALSE;
  40.  
  41. while(itsDone == FALSE)
  42.     {
  43.         ModalDialog(nil, &itemHit);
  44.         
  45.         if (itemHit == iOK) itsDone = TRUE;
  46.     }
  47.  
  48. CloseDialog(theDialog);
  49.  
  50. if (Exit == TRUE)    ExitToShell();
  51. }